﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QS.Logic.Modules;

namespace QS.Game.Logic.Modules
{
    class QModularSpaceShipModel
    {
        QModularSpaceShip m_Ship;

        List<QModuleModel> m_ModuleModels;

        public QModularSpaceShipModel(QModularSpaceShip ship)
        {
            m_Ship = ship;
            m_ModuleModels = new List<QModuleModel>();
            CalcModel();
        }

        public void CalcModel()
        {
            m_ModuleModels.Clear();
            foreach (QShipModule module in m_Ship.m_Modules)
            {
                QModuleModel newModel = null;
                if (module is QShipCockpit)
                {
                    newModel = new QCockpitModel((QShipCockpit)module);
                }
                if(newModel != null)
                m_ModuleModels.Add(newModel);
            }
        }

        public void Draw(QCamera camera)
        {
            foreach (QModuleModel model in m_ModuleModels)
            {
                model.Draw(camera);
            }
        }
    }
}
